﻿using System.Collections.Generic;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using Twins.Interface;
using Twins.Interface.IHandler;

namespace Twins.Classes.Hanlder.HanlderExpression
{
    public class HanlderForIInvocationExpression : IHandler<IInvocationExpression>
    {
        public IEnumerable<ILineCode> DoFor(IInvocationExpression invocationExpression)
        {
            string invokedExpression = invocationExpression.InvokedExpression.GetText();
            return new List<ILineCode> { new LineCode(invocationExpression, invokedExpression) }; 
        }
        
        public IEnumerable<ILineCode> DoFor(object obj)
        {
            return DoFor((IInvocationExpression)obj);
        }
    }
}